	{include file="Public:header" /}

		<div class="bar bar-nav">
			<h1 class="title">专家</h1>
			<i class="icon icon-left" onclick="window.history.go(-1);"></i>
		</div>
		<nav class="bar bar-tab">

			<a class="tab-item active" href="{:U('Index/index')}">
				<span class="icon icon-home"></span>
				<span class="tab-label">首页</span>
			</a>
<!--                    <a class="tab-item" onclick="zixun();">
				<span class="icon iconfont icon-phone"></span>
				<span class="tab-label">咨询</span>
			</a>-->
                        <a class="tab-item open-indicator " href="{:U('Users/index')}">
				<span class="icon iconfont icon-account"></span>
				<span class="tab-label">我的</span>
			</a>
                    {if condition="$apply_count"}
			<a class="tab-item" href="{:U('Apply/expert_join')}">
				<span class="icon iconfont icon-account"></span>
				<span class="tab-label">我要加入</span>
			</a>
                    {/if}
		</nav>

		<div class="content">
                    <form name="apply" action="{:U('Apply/apply')}" method="get">
			<div class="search pad20">
<!--				<div class="in_map">
					<i class="iconfont icon-map"></i><span id="city-picker">广州市</span>
				</div>-->
				<div class="in_search">
					<div class="searchbar">
						<a class="searchbar-cancel">取消</a>
						<div class="search-input">
							<label class="icon icon-search" for="search"></label>
							<input type="search" id='search' name='name' placeholder='输入关键字...' value='{$name}' />
						</div>
					</div>
				</div>
			</div>
                    </form>
			<div class="swiper-container swiper-container-horizontal">
				<div class="swiper-wrapper">
                                    {foreach name="benner" item="benner" key="k"}
					<div class="swiper-slide"><a href="{$benner['link']}"><img src="{$benner['advert_img']}"></a></div>
					{/foreach}
				</div>
				<div class="swiper-pagination swiper-pagination-clickable swiper-pagination-bullets">
					<span class="swiper-pagination-bullet swiper-pagination-bullet-active"></span>
					<span class="swiper-pagination-bullet"></span>
				</div>
			</div>
            <!--专家推荐-->
            <div class="card expert">
                <div class="card-header">
                    <h1 class="title">专家推荐</h1></div>
                <div class="card-content">
                    <div class="card-content-inner clearfix" id="imgsize">
                        <ul>
                            {foreach name="apply" item="apply" key="aa"}
                            <a href="{:U('Apply/expert_page',array('id'=>$apply['id']))}">
                                <li><img src="{$apply['headimgurl']}">
                                    <p>{$apply['user_name']}</p><span>
                                                                    [&nbsp;{switch name="apply['type']"}
                                                                        {case value="1"}军事专家{/case}
                                                                        {case value="2"}国防专家{/case}
                                                                        {case value="3"}医学专家{/case}
                                                                    {/switch}&nbsp;]</span></li>
                            </a>
                            {/foreach}
                        </ul>
                    </div>
                </div>
            </div>

            <!-- 暂时把服务移动到这-->
           <!-- <div class="card in_list_icon in_bodies">
                <div class="card-header">延伸服务<a href="{:U('Serve/hotelList')}" class="pull-right">更多>></a></div>
                <div class="card-content clearfix">
                    <ul>
                        <li><a href="{:U('Serve/hotelList')}"><i class="iconfont icon-shichang"></i>酒店服务</a></li>
                        <li><a href="{:U('Serve/trafficList')}"><i class="iconfont icon-sport"></i>交通服务</a></li>
                    </ul>
                </div>
            </div>-->


			
			<div class="buttons-tab screen" style="margin-top:10px;">
                            <div id="mechanism-tab" style="width: 100%">
                                    <a href="#order_1" class="tab-link button active" style="width: 25%;float: left">
                                        全部
                                    </a>
                                    <a href="#order_2" class="tab-link button" style="width: 25%;float: left">
                                        军事专家
                                    </a>
                                    <a href="#order_3" class="tab-link button" style="width: 25%;float: left">
                                        国防专家
                                    </a>
                                    <a href="#order_4" class="tab-link button" style="width: 25%;float: left">
                                        医学专家
                                    </a>
				</div>
			</div>
                    <div class="tabs">
                        <div class="tab mechan active expert2"  id="order_1">
                            <div id="all_apply">
                            {foreach name="all_apply" item="all_apply" key="aa"}
                            
                            <div class="card demo-card-header-pic">
                                <div valign="bottom" class="card-header color-white no-border no-padding">
                                    <img class='card-cover' src="{$all_apply['headimgurl']}" alt="">
                                    <a href="{:U('Apply/expert_page',array('id'=>$all_apply['id']))}" class="button button-fill">预约</a>
                                </div>
                                <div class="card-content">
                                    <div class="card-content-inner">
                                        <p class="hot_list_title"><font class="name">{$all_apply['user_name']}</font>  
                                            [&nbsp;{switch name="all_apply['type']"}
                                               {case value="1"}军事专家{/case}
                                               {case value="2"}军事技能{/case}
                                               {case value="3"}军事理论{/case}
                                            {/switch}&nbsp;]
                                            {if condition="$all_apply['collection'] eq 0"}
                                            <span id="block" onclick="guanzhu(this, {$all_apply['id']})">关注</span>
                                            <span style='color: #e88d00;display: none'>已关注</span>
                                            {else/}
                                            <span id="display" style='color: #e88d00;'>已关注</span>
                                            {/if}
                                        </p>
                                        <a href="{:U('Apply/expert_page',array('id'=>$all_apply['id']))}"><p class="card-text">{:mb_substr($all_apply['signature'],0,50,'utf-8')}……</p></a>
                                        <p class="card-footer">
                                            <!--<span>好评<font>{$all_apply['praise_number']}</font></span>-->
                                            <span>浏览<font>{$all_apply['visit_number']}</font></span>
                                        </p>
                                    </div>
                                </div>
                            </div>
                            
                            {/foreach}
                            </div>
                            {if condition="$all_show"}
                            <div class="infinite-scroll-preloader" id="all_quan" style="display:none;">
                                <div class="preloader"></div>
                            </div>
                            <p onclick="ajax_apply_all_submit();" class="all_more" id="load_more"><span class="icon icon-down"></span> 点击加载更多...</p>
                            {else/}
                            <p id="load_more"> 暂无数据！</p>
                            {/if}
                        </div>
                        
                        <div class="tab mechan expert2" id="order_2">
                            <div id="military_apply">
                            {foreach name="military_apply" item="military" key="mm"}
                            
                            <div class="card demo-card-header-pic">
                                <div valign="bottom" class="card-header color-white no-border no-padding">
                                    <img class='card-cover' src="{$military['headimgurl']}" alt="">
                                    <a href="{:U('Apply/expert_page',array('id'=>$military['id']))}" class="button button-fill">预约</a>
                                </div>
                                <div class="card-content">
                                    <div class="card-content-inner">
                                        <p class="hot_list_title"><font class="name">{$military['user_name']}</font>  
                                            [&nbsp;{switch name="military['type']"}
                                               {case value="1"}军事专家{/case}
                                               {case value="2"}国防专家{/case}
                                               {case value="3"}医学专家{/case}
                                            {/switch}&nbsp;]
                                            {if condition="$military['collection'] eq 0"}
                                            <span id="block" onclick="guanzhu(this, {$military['id']})">关注</span>
                                            <span style='color: #e88d00;display: none'>已关注</span>
                                            {else/}
                                            <span id="display" style='color: #e88d00;'>已关注</span>
                                            {/if}
                                        </p>
                                        <a href="{:U('Apply/expert_page',array('id'=>$military['id']))}"><p class="card-text">{:mb_substr($military['signature'],0,50,'utf-8')}……</p></a>
                                        <p class="card-footer">
<!--                                            <span>好评<font>{$military['praise_number']}</font></span>-->
                                            <span>浏览<font>{$military['visit_number']}</font></span>
                                        </p>
                                    </div>
                                </div>
                            </div>
                            
                            {/foreach}
                            </div>
                            {if condition="$military_show"}
                            <div class="infinite-scroll-preloader" id="military_quan" style="display:none;">
                                <div class="preloader"></div>
                            </div>
                            <p onclick="ajax_military_submit();" class="military_more" id="load_more"><span class="icon icon-down"></span> 点击加载更多...</p>
                            {else/}
                            <p id="load_more"> 暂无数据！</p>
                            {/if}
                        </div>
                        
                        <div class="tab mechan expert2" id="order_3">
                            <div id="defence_apply">
                            {foreach name="defence_apply" item="defence" key="dd"}
                            
                            <div class="card demo-card-header-pic">
                                <div valign="bottom" class="card-header color-white no-border no-padding">
                                    <img class='card-cover' src="{$defence['headimgurl']}" alt="">
                                    <a href="{:U('Apply/expert_page',array('id'=>$defence['id']))}" class="button button-fill">预约</a>
                                </div>
                                <div class="card-content">
                                    <div class="card-content-inner">
                                        <p class="hot_list_title"><font class="name">{$defence['user_name']}</font>  
                                            [&nbsp;{switch name="defence['type']"}
                                               {case value="1"}军事专家{/case}
                                               {case value="2"}国防专家{/case}
                                               {case value="3"}医学专家{/case}
                                            {/switch}&nbsp;]
                                            {if condition="$defence['collection'] eq 0"}
                                            <span id="block" onclick="guanzhu(this, {$defence['id']})">关注</span>
                                            <span style='color: #e88d00;display: none'>已关注</span>
                                            {else/}
                                            <span id="display" style='color: #e88d00;'>已关注</span>
                                            {/if}
                                        </p>
                                        <a href="{:U('Apply/expert_page',array('id'=>$defence['id']))}"><p class="card-text">{:mb_substr($defence['signature'],0,50,'utf-8')}……</p></a>
                                        <p class="card-footer">
                                            <!--<span>好评<font>{$defence['praise_number']}</font></span>-->
                                            <span>浏览<font>{$defence['visit_number']}</font></span>
                                        </p>
                                    </div>
                                </div>
                            </div>
                            
                            {/foreach}
                            </div>
                            {if condition="$defence_show"}
                            <div class="infinite-scroll-preloader" id="defence_quan" style="display:none;">
                                <div class="preloader"></div>
                            </div>
                            <p onclick="ajax_defence_submit();" class="defence_more" id="load_more"><span class="icon icon-down"></span> 点击加载更多...</p>
                            {else/}
                            <p id="load_more"> 暂无数据！</p>
                            {/if}
                        </div>
                        
                        <div class="tab mechan expert2" id="order_4">
                            <div id="medicine_apply">
                            {foreach name="medicine_apply" item="medicine" key="me"}
                            
                            <div class="card demo-card-header-pic">
                                <div valign="bottom" class="card-header color-white no-border no-padding">
                                    <img class='card-cover' src="{$medicine['headimgurl']}" alt="">
                                    <a href="{:U('Apply/expert_page',array('id'=>$medicine['id']))}" class="button button-fill">预约</a>
                                </div>
                                <div class="card-content">
                                    <div class="card-content-inner">
                                        <p class="hot_list_title"><font class="name">{$medicine['user_name']}</font>  
                                            [&nbsp;{switch name="medicine['type']"}
                                               {case value="1"}军事专家{/case}
                                               {case value="2"}国防专家{/case}
                                               {case value="3"}医学专家{/case}
                                            {/switch}&nbsp;]
                                            {if condition="$medicine['collection'] eq 0"}
                                            <span id="block" onclick="guanzhu(this, {$medicine['id']})">关注</span>
                                            <span style='color: #e88d00;display: none'>已关注</span>
                                            {else/}
                                            <span id="display" style='color: #e88d00;'>已关注</span>
                                            {/if}
                                        </p>
                                        <a href="{:U('Apply/expert_page',array('id'=>$medicine['id']))}"><p class="card-text">{:mb_substr($medicine['signature'],0,50,'utf-8')}……</p></a>
                                        <p class="card-footer">
                                            <!--<span>好评<font>{$medicine['praise_number']}</font></span>-->
                                            <span>浏览<font>{$medicine['visit_number']}</font></span>
                                        </p>
                                    </div>
                                </div>
                            </div>
                                
                            {/foreach}
                            </div>
                            {if condition="$medicine_show"}
                            <div class="infinite-scroll-preloader" id="medicine_quan" style="display:none;">
                                <div class="preloader"></div>
                            </div>
                            <p onclick="ajax_medicine_submit();" class="medicine_more" id="load_more"><span class="icon icon-down"></span> 点击加载更多...</p>
                            {else/}
                            <p id="load_more"> 暂无数据！</p>
                            {/if}
                        </div>
                    </div>
			
		</div>

                {include file="Public:footer" /}
    
<script>
     jQuery(document).ready(function() {
        var type = '{$type}';
        if(!type){
            return false;
        }else if(type==1){
            $('#mechanism-tab a').removeClass('active');
            $('#order_2').siblings().removeClass('active');
            $('#mechanism-tab a:eq(1)').addClass('active');
            $('#order_2').addClass('active');
        }else if(type==2){
            $('#mechanism-tab a').removeClass('active');
            $('#order_3').siblings().removeClass('active');
            $('#mechanism-tab a:eq(2)').addClass('active');
            $('#order_3').addClass('active');
        }else if(type==3){
            $('#mechanism-tab a').removeClass('active');
            $('#order_4').siblings().removeClass('active');
            $('#mechanism-tab a:eq(3)').addClass('active');
            $('#order_4').addClass('active');
        }
    }); 
    
    //咨询
    function zixun(){
        Zepto.confirm("蔡总：13456789123<br>李总：13456789456", '咨询电话','success top');
        return false;
    };
    //关注
    function guanzhu(obj,id) {
        $.ajax({
            type : 'post',
            dataType:'json',
            url : "{:U('Apply/ajaxGuanzhu')}",
            data : {'id':id},
            success : function (data) {
                if(data.status ==1)
                {
                    $(obj).hide();
                    $(obj).nextUntil("span:first").show();
                    Zepto.toast('已关注！', 2000, 'success top');
                    return false;
                }else if(data.status ==2){
                    Zepto.toast('关注失败！', 2000, 'success top');
                    return false;
                }else if(data.status ==3){
//                    layer.confirm("成为会员后才能关注，请先申请会员",{btn:['申请会员','不了'], icon:5, closeBtn: 2 },function(index){
//                        window.location.href="{:U('Users/usersDetail')}";
//                    });
                    Zepto.confirm("成为会员后才能关注，请先申请会员", '温馨提示',function(){
                        window.location.href="{:U('Users/usersDetail')}";
                    });
                    return false;
                    }
            }
        });
    }

        //搜索
    function expert_type(obj,id) {
        var search=$('#search').val();
        $.ajax({
            type : 'post',
            dataType:'html',
            url : "{:U('Apply/ajax_apply')}",
             async : false,   //取消同步，执行完之后再往下执行
            data : {id:id,name:search},
            success : function (data) {
                $("#ajax_return").html('');
                $("#ajax_return").append(data);
                
            }
        });
    }
    
</script>
                
<script>
var  page = 1;
 /*** ajax 提交表单 查询全部列表结果*/  
 function ajax_apply_all_submit()
 {	 	 	 
	 	$("#all_quan").show();
        page += 1;
		$.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Apply/allApply/is_ajax/1/p/"+page+"/name/{$name}",//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				$("#all_quan").hide();
				if($.trim(data) == ''){
					$('.all_more').hide();
				}else{
				    $("#all_apply").append(data);
				}
			}
		}); 
 } 
 
 var  page_release = 1;
 /*** ajax 提交表单 查询军事列表结果*/  
 function ajax_military_submit()
 {	 	 	 
	 	$("#release_quan").show();
        page_release += 1;
		$.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Apply/MilitaryApply/is_ajax/1/p/"+page_release+"/name/{$name}",//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				$("#military_quan").hide();
				if($.trim(data) == ''){
					$('.military_more').hide();
				}else{
				    $("#military_apply").append(data);
				}
			}
		}); 
 } 
 
 var  page_stay = 1;
 /*** ajax 提交表单 查询国防列表结果*/  
 function ajax_defence_submit()
 {	 	 	 
	 	$("#stay_quan").show();
	 	page_stay += 1;
		$.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Apply/DefenceApply/is_ajax/1/p/"+page_stay+"/name/{$name}",//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				$("#defence_quan").hide();
				if($.trim(data) == ''){
					$('.defence_more').hide();
				}else{
				    $("#defence_apply").append(data);
				}
			}
		}); 
 } 
 
 var  page_not = 1;
 /*** ajax 提交表单 查询医学列表结果*/  
 function ajax_medicine_submit()
 {	 	 	 
	 	$("#not_quan").show();
	 	page_stay += 1;
		$.ajax({
			type : "GET",
			//url:"/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p="+page,//+tab,			
			url:"/Apply/MedicineApply/is_ajax/1/p/"+page_not+"/name/{$name}",//+tab,
//			data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
			success: function(data)
			{
				$("#medicine_quan").hide();
				if($.trim(data) == ''){
					$('.medicine_more').hide();
				}else{
				    $("#medicine_apply").append(data);
				}
			}
		}); 
 } 
</script>

</html>